package com.next

import grails.transaction.Transactional

@Transactional
class AssetTeamService
{

    def initAssetTeam(Asset asset, User user)
    {
        def assetTeam = AssetTeam.find("from AssetTeam where asset.id = :asset and user.id = :user",
                                       [asset: asset.id, user: user.id])

        if (!assetTeam)
        {
            assetTeam = new AssetTeam()
            assetTeam.asset = asset
            assetTeam.user = user
            assetTeam.save flush: true
        }
    }
}
